<template>
	<!-- ant-card-bordered-->
	<view class="test-panel-controller">
		
		<span class="fab-title-info">
			仿真考试
		</span>
		
		
		
		<view v-if="showImg" class="img-preview">
			<view class="img-preview-content">
				<image style="width: 80%!important;height:80%!important" mode="aspectFit"  :src="`${$cdn}${cur_qs.img}`"></image>
			</view>
			<view style="width: 100%;display: flex;justify-content: center;">
				<button style="width: 20%;" @click="showImg=false">关闭</button>
			</view>
		</view>
		
		
		<view class="quesction-show-info ant-card-bordered">
			<view  class="info-content">
			<!-- 	<view class="maxwidth">
				<a-typography-text type="secondary" :style="getColor">
						{{cur_qs.infoname}}--{{cur_qs.s_id}}
					</a-typography-text> 
				 <a-button v-show="controllerStatus.SOUND_QS" @click="openSoundQs">语音读题</a-button>
				
				</view> -->
				<view class="maxwidth" :style="[needResvoeFlex]">
					<a-typography-text style="text-align: left;line-height: 66rpx;" :style="[getColor,needResvoe]" class="SimFont">
						{{cur_index+1}}. {{cur_qs.q_desc}}
					</a-typography-text>
				</view>
				
				<checkbox-group @change="onCheckChange">
					<view class="maxwidth" v-for="(item,index) in cur_qs.q_struct" :style="[getColor]">
						<view :style="[needResvoe]">
							<checkbox v-if="cur_qs.q_type == '1'" :checked="cur_qs.check[index]" :value="index+''"
								:disabled="cur_qs.isright!=undefined">
							</checkbox>
							<a-typography-text :style="[getColor,needResvoe]">
								{{label[index]}}. {{item.value}}
							</a-typography-text>
						</view>
					</view>
				</checkbox-group>
				
			<!-- 	<view class="maxwidth" v-for="(item,index) in cur_qs.q_struct" :style="getColor">
					<view>
						<a-checkbox v-if="cur_qs.q_type == '1'" v-model:checked="cur_qs.check[index]" :value="index" class="SimFont"
							@change="onCheckChange">
						</a-checkbox>
						<a-typography-text :style="getColor" style="line-height: 66rpx;" class="SimFont">
							{{label[index]}}. {{item.value}}
						</a-typography-text>
					</view>
				</view> -->
			</view>
	
		</view>
		<view class="quesction-ans-info ant-card-bordered" v-show="controllerStatus.SHOW_EXPLAN">
			<a-typography-paragraph>
				{{cur_qs.q_analyse}}
			</a-typography-paragraph>>
		</view>
		<view class="quesction-controller-box ant-card-bordered">
			<view class="maxwidth ans">
				<a-row class="maxwidth" type="flex" v-if="cur_qs!=null" align="middle">
					<a-col flex="6">
						<a-row>

							<a-col :span="24">
								<a-typography-text style="color: red;font-size: 36rpx;" class="SimFont">
									{{textInfo[cur_qs.q_type]['tips']}}
								</a-typography-text>
							</a-col>

						</a-row>
						<a-row>

							<a-col :span="24">
								<a-typography-text style="font-size: 36rpx;" class="SimFont">
									请在备选答案中选择你认为正确的答案! 
								</a-typography-text>
							</a-col>

						</a-row>
					</a-col>
					<a-col flex="6">
						<a-row justify="center">
							<a-col>
								<a-button @click="last()">上一题</a-button>
							</a-col>
							<a-col>
								<a-button @click="next()">下一题</a-button>
							</a-col>
							<a-col>
								<a-button @click="$emit('submit')">交卷</a-button>
							</a-col>
						</a-row>
					</a-col>
				</a-row>
			</view>
		</view>
		<view class="ant-card-bordered quesction-change-box">
			<a-skeleton active :loading="cur_qs==null">
			</a-skeleton>

	
			<a-row type="flex" style="align-items: center;width: 100%;">
				<a-col :flex="2" style="align-self: flex-start;">
					<a-typography-text style="color: blue;font-size: 36rpx" class="SimFont">
						你选择的答案:
					</a-typography-text>

					<template v-if="cur_qs.showAns">
						<a-tag style="font-size: 24px;padding:12px" v-for="(item,index) in getChangeAns">
							{{item}}
						</a-tag>
					</template>
					<uni-icons style="margin-top:12rpx" :type="cur_qs.isright?'checkmarkempty':'closeempty'"
						:color="cur_qs.isright?'#36e206':'#ff1010'" size="32"
						v-if="controllerStatus.SHOW_RIGHT_OR_ERR && cur_qs.isright!=undefined">
					</uni-icons>
				</a-col>
			<!-- 	<a-col :flex="2" v-show="controllerStatus.SHOW_ANS && cur_qs.isright == false ">
					<a-typography-text>
						正确答案:
					</a-typography-text>
					<a-tag style="font-size: 24px;padding:12px"
						v-for="(item,index) in textInfo[cur_qs.q_type].getAns(cur_qs)">
						{{item}}
					</a-tag>
				</a-col> -->
				<a-col :flex="3" v-if="cur_qs.isright!=true && cur_qs.isright !== false" style="display: flex;justify-content: right;">
					<!-- <a-typography-text>
						选择:
					</a-typography-text> -->
					<a-tag style="font-size:24px;padding:12px" v-for="(item,index) in cur_qs.q_struct" :closable="false"
						@click="tiggerItem(item.index,index)">
						{{textInfo[cur_qs.q_type]['label'][index]}}
					</a-tag>
					<a-button v-if="cur_qs.q_type=='1' && !cur_qs.showAns" @click="showAns(2)">确定</a-button>
				</a-col>
				<a-col style="display: flex;justify-content: center;">
					<a-button v-if="hasLast" @click="lastSubmit">确定</a-button>
				</a-col>
			</a-row>



		</view>
		<view class="quesction-img-box" v-if="cur_qs.img && cur_qs.img.length>3">
			<view class="imageshow-box">
				
					
					<img @click="isShowImg"  :src="`${$cdn}${cur_qs.img}`"
					 style="max-height:150px;max-width:800px;object-fit:scale-down;" />
				<!-- <image @click="isShowImg"  :src="`${$cdn}${cur_qs.img}`"
				 style="height:150px;width:300px;" mode="aspectFit" /> -->
				<!-- <a-image class="imageshow" :src="`${$cdn}${cur_qs.img}`" height="250" :preview="true" /> -->
			</view>
		</view>
	</view>
</template>

<script>
	let db = uniCloud.database()
	let dbCmd = db.command
	export default {
		name: "test-mock-controller",
		props: {
			getTestTime:null,
			needCache: {
				type:Boolean,
				default:true
			},
			scoreRole: {},
			action: {
				default: 'CUSTMO',
				type: String
			},
			score: 0,
			controllerStatus: {
				"AUTO_PAGE": false,
				"RIGHT_PAGE": false,
				"SHOW_ANS": false,
				"SHOW_EXPLAN": false,
				"SHOW_RIGHT_OR_ERR": false,
				"SOUND_EXPLAN": false,
				"SOUND_QS": false,
				"SOUND_ON_ERR": false,
				"SOUND_RIGHT_OR_ERR": false,
				"TURN_PAGE": true,
				"AUTO_PAGE": false,
				"RIGHT_PAGE": false
			},
			quesctionlist: [Array],
			currentIndex: [Number],
			useCacheAns: false,
			rightNum: 0,
			errorNum: 0,
			ansArr: {},
			ans: null
		},
		watch: {
			'controllerStatus.SOUND_EXPLAN'(nv, ov) {
				// console.log(nv)
				this.openSoundExplan(nv)
			},
			'controllerStatus.TURN_PAGE'(nv) {
				if (nv) {
					this.$emit('changeStatus', 'TURN_PAGE', nv)
				}
			},
			'controllerStatus.AUTO_PAGE'(nv) {
				if (nv) {
					this.$emit('changeStatus', 'AUTO_PAGE', nv)
				}
			},
			'controllerStatus.RIGHT_PAGE'(nv) {
				if (nv) {
					this.$emit('changeStatus', 'RIGHT_PAGE', nv)
				}
			},
			cur_index(nv, ov) {
				this.$emit('update:currentIndex', nv)
			},
			r_num(nv) {
				this.$emit('update:rightNum', nv)
			},
			e_num(nv) {
				this.$emit('update:errorNum', nv)
			}
		},

		emits: ['update:currentIndex', 'update:rightNum', 'update:errorNum', 'changeStatus', 'removeQueslist', 'submit'],
		data() {
			return {
				showImg:false,
				lastClick:0,
				rightList: [],
				real_score: 0,
				r_num: 0,
				e_num: 0,
				errlist: {},
				qs_ans_arr: {},
				qs_ans: [],
				cur_qs: null,
				label: ['A', 'B', 'C', 'D', 'E', 'F'],
				labelAns: {
					'0': 'A',
					'1': 'B',
					'2': 'C',
					'3': 'D',
					'4': 'E',
					'5': 'F'
				},
				AnsOfLable: {
					'A': '0',
					'B': '1',
					'C': '2',
					'D': '3',
					'E': '4',
					'F': '5',
				},
				//判断 为黑色、单选为蓝色、多选为红色。右侧题框里不显示试题序
				textInfo: {
					"0": {
						"value": 0,
						"text": "单选",
						"color": "#0533fc",
						"label": ['A', 'B', 'C', 'D', 'E', 'F'],
						"tips": "操作提示：单选题",
						"getAns": function(cur_qs) {
							if (cur_qs.realProps) {
								return [cur_qs.realProps.realAns]
							} else {
								return '出现异常，联系管理员CODE:7701'
							}
						},
						labelAns: {
							'0': 'A',
							'1': 'B',
							'2': 'C',
							'3': 'D',
							'4': 'E',
							'5': 'F'
						}
					},
					"1": {
						"value": 1,
						"text": "多选",
						"color": "#ff0000",
						"label": ['A', 'B', 'C', 'D', 'E', 'F'],
						"tips": "操作提示：多项选择题",
						"getAns": function(cur_qs) {
							if (cur_qs.realProps) {
								return cur_qs.realProps.realAns.split('|')
							} else {
								return '出现异常，联系管理员CODE:7702'
							}
						},
						labelAns: {
							'0': 'A',
							'1': 'B',
							'2': 'C',
							'3': 'D',
							'4': 'E',
							'5': 'F'
						},
					},
					"2": {
						"value": 2,
						"text": "判断",
						"color": "#000000",
						"label": ['√', '×'],
						"tips": "操作提示：判断题",
						"getAns": function(cur_qs) {
							let label = {
								'A': '√',
								'B': '×'
							}
							return [label[cur_qs.q_ans]]
						},
						labelAns: {
							'0': '√',
							'1': '×',
						},
					},
				},
				cur_index: 0,
				cur_ans_index: 0,
				err_ans_index: [],
				right_ans_index: [],
				user_ans_list: [],
				qs_typeText: [
					'单选',
					'多选',
					'简答'
				],
				soundTaskStatus: null,
				rightFileTempPath: 'right.mp3',
				errFileTempPath: "error.mp3",
				rightIndexList: []
			}
		},
		created() {
			//console.log(this.quesctionlist[0])
			const self = this
			//	console.log(this.controllerStatus)
			this.qs_ans = this.ans
			this.qs_ans_arr = this.ansArr
			this.cur_index = this.currentIndex
			this.r_num = this.rightNum
			this.e_num = this.errorNum
			if (this.cur_index > 0) {
				this.cur_qs = this.quesctionlist[this.cur_index]
			} else {
				this.cur_qs = this.quesctionlist[0]
			}
			this.errlist = new Set()
			// uni.downloadFile({
			// 	url: self.$cdn+'right.mp3',
			// 	success: function(res) {
			// 		console.log(res)

			// 		self.rightFileTempPath = res.tempFilePath
			// 		uni.downloadFile({
			// 			url: self.$cdn+'error.mp3',
			// 			success: function(errRes) {
			// 				self.errFileTempPath = errRes.tempFilePath
			// 			}
			// 		})

			// 	}
			// })
		},
		mounted() {
			// console.log('mockt moutd')
			// console.log(this.qlist)
		},

		computed: {
			needResvoe(){
			if(this.cur_qs.lang_txt =='WY' || this.cur_qs.lang_txt == 'HY'){
				return { direction: 'rtl',unicodeBidi: 'bidi-override',justifyContent:'flex-end'} 
			}else{
				return false
			}
			},
			needResvoeFlex(){
				if(this.cur_qs.lang_txt =='WY' || this.cur_qs.lang_txt == 'HY'){
					return { justifyContent:'flex-end'} 
				}else{
					return false
				}
			},
			hasLast(){
				let qlen = this.quesctionlist.length -1 
				let status = false 
				if(qlen == this.cur_index && !this.cur_qs.showAns){
					status = true
				}
				console.log('zui',status)
				return status
			},
			getColor() {
				return {
					color: this.textInfo[this.quesctionlist[this.cur_index].q_type].color
				}
			},
			isRightCp() {
				if (this.cur_qs.q_type != '2') {
					// console.log(this.getChangeAnsFn().join('|') === this.cur_qs.realProps.realAns)
					if (!(this.getChangeAnsFn().join('|') === this.cur_qs.realProps.realAns)) {
						// console.log('错')
						this.errlist.set(this.cur_qs.s_id)
						return false
					}
				} else {
					// console.log(this.labelAns[this.qs_ans.join()], this.cur_qs.q_ans)
					if (!(this.labelAns[this.qs_ans.join()] === this.cur_qs.q_ans)) {
						// console.log('错')
						this.errlist.set(this.cur_qs.s_id)
						return false
					}
				}
				return true
			},
			getChangeAns() {
				let arr = []
				//let labArr [] 
				this.cur_qs.q_struct.forEach((e, i) => {
					if (this.qs_ans.includes(e.index)) {
						arr.push(this.textInfo[this.cur_qs.q_type]['labelAns'][`${i}`])
					}
				})
				return arr
			}
		},
		methods: {
			lastSubmit(){
				let ans = false 
				if (this.cur_qs.q_type == '1'
				    && this.cur_qs.isright == undefined 
					&& this.qs_ans.length>0) {
					ans = this.showAns(2)
				} 
				
				if(this.cur_qs.q_type != '1'&&this.cur_qs.isright == undefined && this.qs_ans.length>0) {
					ans = this.showAns()
				}
				
				if( this.cur_qs.isright===false && this.cur_qs.isShowError == undefined){
					// this.cur_qs.isShowError = true 
					this.$set(this.cur_qs,'isShowError', true)
					return 
				}
				
				
			},
			isShowImg(){
				
				this.showImg = true
				return 
				
				let now = (new Date).getTime()
				if(this.lastClick===0){
					this.lastClick = now
					setTimeout(()=>{
						this.lastClick=0 
						console.log("cacel",this.lastClick)
						},400)
					return 
				}
				let clickTimes = now - this.lastClick
				if(  clickTimes <400 && clickTimes>0){
					this.showImg = true 
				}
			},
			saveCache(cacheCurrentHistory=true){
				// console.log('test mock unmount start')
				// console.log(this.getTestTime)
				// console.log('test mock need cache =',this.needCache)
				const self = this
				let errlist = []
				let errlistremove = []
						
				for (let s of this.errlist.values()) {
					errlist.push({
						q_id: s
					})
					errlistremove.push(s)
				}
				
				// for (let s of this.quesctionlist) {
				// 	if(s.hasOwnProperty('showAns')==false){
				// 		errlist.push({
				// 			q_id:s.s_id
				// 		})
				// 		errlistremove.push(s.s_id)
				// 	}
				// 	if(s.isright){
				// 		errlistremove.push(s.s_id)
				// 	}
				// }
				const userinfo = uni.getStorageSync('info')
				
				if (this.rightList.length > 0) {
					db.collection('error-qlist').where({
						q_id: db.command.in(this.rightList),
						user_id: userinfo.uid
					}).remove()
				}
				
				if (errlist.length > 0) {
					db.collection('error-qlist').where({
						q_id: db.command.in(errlistremove),
						user_id: userinfo.uid
					}).remove().then(res => {
						db.collection('error-qlist').add(errlist).then(resError => {
							console.log('error list ',resError)
						})
					})
				}
				if (cacheCurrentHistory==true) {
					// console.log('test mock need cache')
					db.collection('test-history').where({
						user_id: dbCmd.eq(userinfo.uid)
					}).remove().then(res => {
						//	console.log(res)
						return 'ok'
					}).then(res => {
						// db.collection('test-history')
						// 	.add({
						// 		cachedata: {
						// 			r_num: self.r_num,
						// 			e_num: self.e_num,
						// 			qlist: self.quesctionlist,
						// 			ans: self.qs_ans_arr,
						// 			cur_index: self.cur_index,
						// 			cur_ans: self.qs_ans
						// 		},
						// 		role:self.scoreRole,
						// 		time:self.getTestTime,
						// 		cacheType:'MOCKTEST'
						// 	}).then(code => {
						// 		//console.log(code)
						// 	})
					})
				}
				
				console.log('test mock end')
				
			},
			getEndTime(){
				
			},
			resetError() {
				this.cur_index = 0
				this.qs_ans = []
				this.r_num = 0
				this.e_num = 0
				this.removeQueslist()
				this.$emit('update:rightNum', this.r_num)
				this.$emit('update:errorNum', this.e_num)
				this.qs_ans_arr = {}
				this.cur_qs = this.quesctionlist[0]
				for (let s of this.quesctionlist) {
					delete s.showAns
					delete s.isright
					delete s.ansLabel
					if (s.check) {
						s.check = [false, false, false, false, false, false]
					}
				}
			},
			resetAll() {
				this.cur_index = 0
				this.cur_qs = this.quesctionlist[0]
				this.qs_ans = []
				this.r_num = 0
				this.e_num = 0
				this.qs_ans_arr = {}
				for (let s of this.quesctionlist) {
					delete s.showAns
					delete s.isright
					delete s.ansLabel
					if (s.check) {
						s.check = [false, false, false, false, false, false]
					}
				}
			},
			createdAudio(url) {
				this.soundTaskStatus = uni.createInnerAudioContext();
				this.soundTaskStatus.autoplay = true;
				this.soundTaskStatus.src = this.$cdn + url
				this.soundTaskStatus.onPlay(() => {
					//	console.log('开始播放');
				});
				this.soundTaskStatus.onError((res) => {
					// uni.showModal({
					// 	title: '资源无法访问!',
					// 	content: '资源无法访问!'
					// })
				});
			},
			getCurChangeAns() {
				return this.qs_ans
			},
			openSoundQs() {
				if (this.soundTaskStatus) {
					this.soundTaskStatus.destroy()
				}
				if (!this.cur_qs.auto_sound) {
					uni.showToast({
						title: '此题暂无音频讲解',
						duration: 2000,
						icon: 'none'
					})
					return
				}
				this.createdAudio('sound/' + this.cur_qs.auto_sound)
			},
			openSoundExplan(status) {
				if (this.soundTaskStatus) {
					this.soundTaskStatus.destroy()
				}
				if (status) {
					if (!this.cur_qs.sound) {
						uni.showToast({
							title: '此题暂无音频讲解',
							duration: 2000,
							icon: 'none'
						})
						return
					}
					this.createdAudio(this.cur_qs.sound)
				}
			},
			getChangeAnsFn() {
				let arr = []
				this.cur_qs.q_struct.forEach((e, i) => {
					if (this.qs_ans.includes(e.index)) {
						arr.push(this.textInfo[this.cur_qs.q_type]['labelAns'][`${i}`])
					}
				})
				arr.sort()
				return arr
			},
			isRightFn() {
				let ans = ''
				let ans_status = true
				if (this.cur_qs.q_type != '2') {
					ans = this.getChangeAnsFn().join('|')
					if (!(ans === this.cur_qs.realProps.realAns)) {
						ans_status = false
						this.errlist.add(this.cur_qs.s_id)
					}
				} else {
					ans = this.labelAns[this.qs_ans.join()]
					if (!(ans === this.cur_qs.q_ans)) {
						ans_status = false
						this.errlist.add(this.cur_qs.s_id)
					}
				}
				if (ans_status) {
					this.r_num++
					this.rightIndexList.push(this.cur_index)
					this.rightList.push(this.cur_qs.s_id)
					this.$emit('update:rightNum', this.r_num)
				} else {
					this.e_num++
					this.$emit('update:errorNum', this.e_num)
				}

				if (this.cur_qs.q_type == '2') {
					this.cur_qs.ansLabel = ans=='A' ? '√' : "✘"
				} else {
					this.cur_qs.ansLabel = this.getChangeAnsFn().join(',')
				}
				this.cur_qs.isright = ans_status
				if (this.controllerStatus.AUTO_PAGE) {
					this.next()
					return
				}
				if (this.controllerStatus.RIGHT_PAGE && ans_status == true) {
					this.next()
					return
				}
				if (this.controllerStatus.SOUND_RIGHT_OR_ERR) {
					let url = ans_status ? this.rightFileTempPath : this.errFileTempPath
					this.createdAudio(url)
				}
				if (this.controllerStatus.SOUND_ON_ERR && ans_status == false) {
					setTimeout(() => this.createdAudio(this.cur_qs.sound), 1000)
				}
				return ans_status	
			},
			isError() {},
			onCheckChange(e) {
				let ans_temp = []
				for (let s of e.detail.value) {
					let target = this.cur_qs.q_struct[s].index
					ans_temp.push(target)
				}
				this.qs_ans = ans_temp
				this.qs_ans_arr[this.cur_qs.s_id] = this.qs_ans
				if (this.cur_qs.q_type == '1') {
					for (let s of e.detail.value) {
						this.cur_qs.check[s] = true
					}
				}
			},
			// onCheckChange(e) {
			// 	//console.log(e.target.checked, e.target.value)
			// 	let target = this.cur_qs.q_struct[e.target.value].index
			// 	if (e.target.checked && this.cur_qs.isright != undefined) {
			// 		this.qs_ans.push(target)
			// 	} else {
			// 		let position = this.qs_ans.indexOf(target)
			// 		if (position) {
			// 			this.qs_ans.splice(position, 1)
			// 		}
			// 	}

			// },

			next() {
				const self = this
				
				// if(this.cur_qs.q_type=='1'){
				// 	if(Object.keys(this.qs_ans).length==0){
				// 		uni.showModal({
				// 			content:'你还没有选择答案'
				// 		})
				// 		return
				// 	} 
				// }
				
				
				if (this.cur_index < this.quesctionlist.length - 1) {
					this.skipQs(this.cur_index + 1,'next')
				} else {
					uni.showModal({
						content: '是否提交?',
						title: 'tips',
						success(res) {
							if (res.confirm) {

								//	self.totalNumber()
								//	self.submitStatus = true
								//	self.allStatus = true
							}
						}
					})
				}
			},
			last() {
				if (this.cur_index != 0) {
					//this.set_loc_history(this.cur_qs_id)
					// if(this.cur_qs.q_type=='1'){
					// 	if(Object.keys(this.qs_ans).length==0){
					// 		uni.showModal({
					// 			content:'你还没有选择答案'
					// 		})
					// 		return
					// 	} 
					// }
					this.skipQs(this.cur_index - 1,'last')
				}
			},
			skipQs(index, action) {
				//	console.log(index)
				//先保存当前数据
				//	this.set_loc_history(this.cur_qs_id)
				//切换下一条数据
				//	this.cur_qs_id = this.user_ans_list[index]._id
				if (this.cur_index === index) {
					return
				}
				if (this.cur_qs.q_type == '1' && this.cur_qs.isright == undefined && action != 'cust_skip' && this.qs_ans.length>0) {
					this.showAns(2)
				}
				
				this.cur_index = index
				// if (action === 'pop') {
				// 	this.$refs.popup.close()
				// }
				this.resetStatus()
				this.cur_qs = this.quesctionlist[this.cur_index]
				this.getCurrQsStatus()
			},
			resetStatus() {
				this.qs_ans_arr[this.cur_qs.s_id] = this.qs_ans
				this.qs_ans = []
				if (this.soundTaskStatus) {
					this.soundTaskStatus.destroy()
					this.soundTaskStatus = null
				}
				//	console.log(this.qs_ans_arr)
			},
			getCurrQsStatus() {
				if (this.qs_ans_arr[this.cur_qs.s_id]) {
					this.qs_ans = this.qs_ans_arr[this.cur_qs.s_id]
				}
			},
			tiggerItem(id, checkIndex) {
				if (this.cur_qs.showAns) {
					return
				}
				const position = this.qs_ans.indexOf(id)
				if (this.qs_ans.length >= 1 && this.cur_qs.q_type != '1') {
					return
				}
				if (position === -1) {
					this.qs_ans.push(id)
					this.qs_ans_arr[this.cur_qs.s_id] = this.qs_ans

				} else {
					this.qs_ans.splice(position, 1)
					this.qs_ans_arr[this.cur_qs.s_id] = this.qs_ans
				}
				if (this.cur_qs.q_type == '1') {
					this.cur_qs.check[checkIndex] = !this.cur_qs.check[checkIndex]
				}
				this.showAns()
			},
		showAns(type) {
			let ans  = true 
			if (this.cur_qs.q_type != 1) {
				ans =  this.isRightFn()
				this.$set(this.cur_qs, 'showAns', true)
			}
			if (type) {
				ans = this.isRightFn()
				this.$set(this.cur_qs, 'showAns', true)
			}
			return ans
		},
			removeQueslist() {
				console.log('正确题目', this.rightIndexList.length)
				console.log('正确题目SID', this.rightList)
				this.$emit('removeQueslist', this.rightList)
				this.rightIndexList = [] 
				this.rightList= []
			}
		},
	}
</script>

<style scoped lang="scss">
	@import url('./testcontroller.css');
</style>
